<?php 
	function get_chinhsach(){
		$ci = &get_instance();
		$ci->load->model("page_model","pm");
		$parent_id = 11 ; // chinh sach plusmainichi
		$info = $ci->db->order_by('sequence','ASC')->get_where("pages",array("parent_id"=>$parent_id))->result();
		return $info;
	}
	function dialog_login($type=0,$not_in_array = array(),$in_array = array()){
		$ci = &get_instance();
		$class_now  = $ci->router->fetch_class();
		$method_now = $ci->router->fetch_method();
		$class_method_now = $class_now."_".$method_now;
		$html_popup = "";
		if($type == 0 and empty($ci->customer) and access_proviso($class_method_now,$not_in_array,$in_array)){
			$ci->load->model("popup_model");
			$data["result_zone"] 	 		 = array("0"=>"-- Tỉnh/TP --") + $ci->popup_model->get_location_select();
			$data["result_category_product"] = $ci->popup_model->get_category_product_select();
			$html_popup = $ci->load->view("popup/popup_register",$data,true);
		}
		//$time = time() + 60*60;
		setcookie("close_popup",1,-1,"/");
		return $html_popup;
	}
	function access_proviso($class_now,$not_in_array,$in_array){
		$close_popup = $_COOKIE["close_popup"];
		if(empty($close_popup)){
			if(!empty($not_in_array[0]) and !empty($not_in_array[0]) and in_array($class_now,$in_array) and !in_array($class_now,$in_array)){
				return true;	
			}
			elseif(!empty($not_in_array[0]) and !in_array($class_now,$not_in_array)){
				return 	true;
			}
			elseif(!empty($in_array[0]) and in_array($class_now,$in_array)){
				return true;	
			}
			elseif(empty($not_in_array[0]) and empty($not_in_array[0])){
				return true;	
			}
		}
		return false;
	}
?>